{assign var="PollItems" value=$Poll->getPollItems()}
<div id="poll-edit-controls">
	<ul class="poll-edit-menu">
		<li><a href="#" onclick="pollToggleEdit('results')">{$ConfigLanguage->get('show-results')}</a></li>
		<li><a href="#" onclick="pollToggleEdit('config')">{$ConfigLanguage->get('show-config')}</a></li>
		<li><a href="#" onclick="pollToggleEdit('answers')">{$ConfigLanguage->get('show-items')}</a></li>
	</ul>
</div>

<div id="poll-edit-results">
{assign var="PollID" value=$Poll->getID()}
{run_app name="poll" method="templateShowPoll" parameters="$PollID;true"}
</div>

<div id="poll-edit-poll" class="label120">
	<form action="{$env.url}admin/configure/poll/update-poll/{$Poll->getID()}/" method="post" id="poll-form-add">
		<p><label for="poll-question">{$ConfigLanguage->get('poll-question')}:</label> <input type="text" name="poll-question" id="poll-question" value="{$Poll->getQuestion()}" /></p>
		<p><label for="poll-active">{$ConfigLanguage->get('poll-active')}: </label> 
			<select name="poll-active" id="poll-active">
				<option value="yes"{if $Poll->isActive() == true} selected="selected"{/if}>{$ConfigLanguage->get('yes')}</option>
				<option value="no"{if $Poll->isActive() == false} selected="selected"{/if}>{$ConfigLanguage->get('no')}</option>
			</select>
		</p>
		<p><label for="poll-show-results">{$ConfigLanguage->get('poll-show-results')}: </label>
			<select name="poll-show-results" id="poll-show-results">
				<option value="yes"{if $Poll->canShowResults() == true} selected="selected"{/if}>{$ConfigLanguage->get('yes')}</option>
				<option value="no"{if $Poll->canShowResults() == false} selected="selected"{/if}>{$ConfigLanguage->get('no')}</option>
			</select>
		</p>
		<p><label for="poll-members-only">{$ConfigLanguage->get('poll-members')}: </label>
			<select name="poll-members-only" id="poll-members-only">
				<option value="no"{if $Poll->membersOnly() == false} selected="selected"{/if}>{$ConfigLanguage->get('no')}</option>
				<option value="yes"{if $Poll->membersOnly() == true} selected="selected"{/if}>{$ConfigLanguage->get('yes')}</option>
			</select>
		</p>
		<p><label for="poll-expires">{$ConfigLanguage->get('poll-expires')}: </label></p>
			<input type="text" name="poll-pick-date" id="poll-pick-date" value="{$Poll->getExpireDate('d.m.Y')}" />
		
		<p><input type="button" onclick="updatePoll()" value="{$ConfigLanguage->get('poll-update')}" name="poll-submit" /></p>
	</form>
</div>

<div id="poll-edit-items">
	<div id="poll-edit-items-container">
	{if $PollItems|@count == 0}
		{$ConfigLanguage->get('no-items')}
	{else}
		<ul class="poll-edit-items-list">
		{foreach from=$PollItems item=Item}
			<li>
				<strong>{$Item->getLabel()}</strong> ({$Poll->getItemPercentage($Item)} % - {$Item->getVotes()} {$ConfigLanguage->get('votes')|lower})
				<ul class="poll-edit-menu">
					<li><a href="#" onclick="pollEditItem('{$Item->getID()}')">{$ConfigLanguage->get('edit-answer')}</a></li>
					<li><a href="{$env.url}admin/configure/poll/delete-poll-item/{$Item->getID()}/">{$ConfigLanguage->get('delete-answer')}</a></li>
				</ul>
			</li>
		{/foreach}
		</ul>
	{/if}
	</div>
	<div id="poll-edit-items-menu">
		<a href="#" onclick="pollAddAnswer('{$ConfigLanguage->get('add-answer')}', '{$Poll->getID()}')">{$ConfigLanguage->get('add-answer')}</a>
	</div>
</div>

<div id="poll-add-error" class="dialogDivision">
	{$ConfigLanguage->get("please-fill-all")}
</div>
<div id="poll-add-answer" class="dialogDivision" title="{$ConfigLanguage->get("add-answer")}">
	<input type="hidden" id="pageURL" value="{$env.url}" />
	{$ConfigLanguage->get("please-enter-answer")}:
	<p><input type="text" name="answer-label" id="answer-label" /></p>
</div>
<div id="poll-edit-item-dialog" title="{$ConfigLanguage->get("edit-answer")}">
</div>